<ion-view view-title="注册" hide-nav-bar="true" id="register">

  <ion-header-bar align-title="center" class="bar-calm">
    <div class="buttons">
      <button class="button head-button button-clear center-btn" ng-click="goBack()">
        <img src="img/order-commit/backIcon.png">
      </button>
    </div>
    <h1 class="title">注册</h1>
  </ion-header-bar>

  <ion-content>
    <div class="notice" ng-if="notify.show" ng-bind="notify.msg">
    </div>
    <rlabel>
      为了确保服务质量，请先验证您的手机
    </rlabel>
    <div ng-form="regForm" class="list">
        <label class="item item-input">
            <span class="input-label">手<span style="margin-left:16px">机</span><span style="margin-left:16px">号</span></span>
            <input type="text" name="phone"
                   ng-model="regData.mobile"
                   ng-required="true"
                   ng-pattern="/^0?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/"
                   placeholder="请输入手机号码">
        </label>
      <div class="item item-input">
          <span class="input-label">短信验证码</span>
          <input type="text" name="phoneValid"
              ng-model="regData.regcode"
              ng-pattern="/^\d{4}$/"
              ng-required="true"
              placeholder="输入4位验证码">
          <button class="button button-clear btn"
                  ng-class="remainTime < 1 ? 'get-valid-code-on':'get-valid-code-off'"
                  ng-disabled="regForm.phone.$invalid || remainTime > 0"
                  ng-click="getVerifyCode()">
          <span ng-if="remainTime < 1">
            获取验证码
          </span>
          <span ng-if="remainTime > 0">
            {{remainTime}}秒
          </span>
          </button>
      </div>

      <div class="item item-input">
          <span class="input-label">密<span style="margin-left:48px">码</span></span>
          <input type="password" name="password"
              ng-model="regData.password"
              ng-required="true"
              placeholder="由6-16位英文字母或数字组成">
      </div>
        <div class="item item-input">
            <span class="input-label">确<span style="margin-left:5px">认</span><span style="margin-left:5px">密</span><span style="margin-left:6px">码</span></span>
            <input type="password" name="confirm"
                   ng-model="regData.confirm"
                   ng-required="true"
                   placeholder="请您再次确认您的密码">
        </div>
        <!--ng-class="{'no-bdbtm':refereeData.refereeName}"-->
        <div class="item item-input">
            <span class="input-label">推荐人编号</span>
            <input type="text" name="referee"
                    ng-model="regData.referee"
                    ng-required="true" ng-change="showReferee()"
                    placeholder="输入推荐人编号">
            <button class="button button-clear btn"
                    style="background-color:#1fbef9;
                                      color: white;min-height: 42px;"
                    ng-click="getReferee()">
              <span>
                如无请点击获取
              </span>
            </button>
        </div>
      <div class="item item-input refereename" ng-if="refereeData.refereeName"
           ng-class="{'sys-color':refereeData.refereeName!='无此推荐人'}">
        <!--<span class="input-label">推荐人名称</span>-->
        ({{refereeData.refereeName}})
      </div>
      <rlabel style="margin-top:20px">
            <input type="checkbox" style="font-size:16px" name="isCheckon"
                    ng-model="isCheckon"
                    ng-required="true">
          我已阅读并同意
          <a href="#/user-agreement">《优品道用户协议》</a>
      </rlabel>
      <div class="register-container">
        <button class="button register button-clear"
            ng-disabled="regForm.$invalid"
            ng-click="register()">
            注 册
          <div ng-if="processing" class="spinner">
            <ion-spinner icon="circles" class="spinner-stable"></ion-spinner>
          </div>
        </button>
      </div>
    </div>
    <div class="bottom-blank"></div>
  </ion-content>
</ion-view>
